<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="keywords" content="">
<meta name="description" content="">
<meta name="generator" content="emlog">
    <!-- Bootstrap Styles-->
    <link href="/jsp/system/assets/css/bootstrap.css" rel="stylesheet" />
    <!-- FontAwesome Styles-->
    <link href="/jsp/system/assets/css/font-awesome.css" rel="stylesheet" />
    <!-- Morris Chart Styles-->
    <link href="/jsp/system/assets/js/morris/morris-0.4.3.min.css" rel="stylesheet" />
    <!-- Custom Styles-->
    <link href="/jsp/system/assets/css/custom-styles.css" rel="stylesheet" />
    <link href="/jsp/system/assets/css/select2.min.css" rel="stylesheet" />
    <!-- jQuery Js -->
    <script src="/jsp/system/assets/js/jquery2.1.1.js" type="text/javascript"></script>
	<script src="/jsp/system/assets/js/bootstrap-3.3.0.js" type="text/javascript"></script>
    <script src="/jsp/system/assets/js/select2.min.js" type="text/javascript"></script>
</head>
<body>
 <div id="wrapper">
        <nav class="navbar navbar-default top-navbar" role="navigation">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".sidebar-collapse">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="index.html">CourageAQ博客</a>
            </div>
        </nav>
        <!--/. NAV TOP  -->
        <nav class="navbar-default navbar-side" role="navigation">
            <div class="sidebar-collapse">
                <ul class="nav" id="main-menu">
                    <li>
                        <a  href="/backblog/index.action"><i class="fa fa-dashboard"></i>文章列表</a>
                    </li>
                     <li>
                        <a href="/backblog/type.action"><i class="fa fa-dashboard"></i>文章分类</a>
                    </li>
                    <li>
                        <a class="active-menu" href="/backblog/upload.action"><i class="fa fa-desktop"></i>文章上传</a>
                    </li>
                 </ul>
            </div>
        </nav>


		<div id="page-wrapper">
			<div id="page-inner">
				<div class="panel-body">
					<div class="row">
						<div class="col-md-12">
							<form action="/admin/upload.action" method="post"
								enctype="multipart/form-data">
								<div class="form-group">
									<label>标题:</label> <input type="text" class="form-control"
										name="title" placeholder="请输入标题">
								</div>
								<div class="form-group">
									<label>简介:</label> <input type="text" class="form-control"
										name="text" placeholder="请输入简介">
								</div>
								<div class="form-group">
									<label>文件:</label> <input type="file" class="form-control"
										name="file">
								</div>
								<div class="form-group">
									<label>所属类型:</label><br /> <select name="type"
										class="js-example-basic-multiple father-btn"
										multiple="multiple" style="width: 100%;">
									</select>
								</div>
								<div style="text-align: center;">
									<button type="submit" class="btn btn-success"
										style="margin-right: 30px;">提交</button>
									<button type="reset" class="btn btn-primary cancel">重置</button>
								</div>
							</form>
						</div>
					</div>
				</div>
			</div>
		</div>
		<!-- /. PAGE WRAPPER  -->
    </div>
    <!-- /. WRAPPER  -->
    <!-- JS Scripts-->
</body>
<script>
$(document).ready(function(){
	//动态加载select的值，获取所有权限名称，并将用户所具有的权限默认添加
  	$.getJSON("/backblog/articletype.action",function(data){
    	console.log(data);
    	var datas=[];
		$.each(data,function(n,m){
			var jsons ={
					id: m.id,
					text: m.typename
					};
			datas.push(jsons);
		});
		$(".js-example-basic-multiple").select2({
			maximumSelectionLength: 1,			//只允许选择一个父级菜单
			data: datas
	    });
		//清空
		//$(".js-example-basic-multiple").empty();
	});
	$(".cancel").click(function(){
		$(".js-example-basic-multiple").empty();
	});
});
</script>
</html>